import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;

public class NumbersDemo {

	public static void main(String[] args) {
		// Format number as currency examples
		Locale bgLocale = new Locale("bg", "BG");
		NumberFormat bgCurrencyFormat = NumberFormat
				.getCurrencyInstance(bgLocale);
		System.out.println(bgCurrencyFormat.format(28.50));

		// Parse number example
		NumberFormat usNumberFormat = NumberFormat.getNumberInstance(bgLocale);
		String number = "1,292,812.00";
		System.out.println("Original number: " + number);
		try {
			Number parsed = (Number) usNumberFormat.parse(number);
			System.out.println("Parsed number: " + parsed);
		} catch (ParseException pe) {
			pe.printStackTrace();
		}
	}

}
